import React from "react";
import{
  HashRouter,
  Switch,
  Route,
  Link
} from "react-router-dom"
import "antd/dist/antd.css";
import {Layout, Menu} from 'antd';
import {PieChartOutlined } from '@ant-design/icons';
import Team from "./Team";
import Timi from "./Timi";
import Tencent from "./Tencent";

const { Header, Sider ,Content} = Layout;

class Home extends React.Component{
  render(){
    return(
      <HashRouter>
     <div>
       <Layout>
       <Header className="header">
          <Menu theme="dark" mode="horizontal" defaultSelectedKeys={['3']}
          onClick={(object)=>{
            // console.log(key)
            if(object.key === "1"){
              this.props.history.push("/about")
            }
          }}>
            <Menu.Item key="1">关于</Menu.Item>
            <Menu.Item key="2">nav 2</Menu.Item>
            <Menu.Item key="3">nav 3</Menu.Item>
          </Menu>
       </Header>
       <Layout>
         <Sider width={200} className="site-layout-background">
           <Menu theme="dark" defaultSelectedKeys={['1']} mode="inline">
             <Menu.Item key="1" icon={<PieChartOutlined />}>
               <Link to="/">学生管理</Link>
             </Menu.Item>
             <Menu.Item key="2" icon={<PieChartOutlined />}>
               <Link to="/team">讲师管理</Link>
             </Menu.Item>
             <Menu.Item key="3" icon={<PieChartOutlined />}>
               <Link to="/tencent">助教管理</Link>
             </Menu.Item>
          </Menu>
         </Sider>
         <Layout>
           <Content
           className="site-layout-background"
           style={{
            padding: 24,
            margin: 0,
            minHeight: 280,
           }}
           >
            <Switch>
              
              <Route path="/team" component={Team}/>
              <Route path="/tencent" component={Tencent}/>
              <Route path="/" component={Timi}/>
            </Switch>
          </Content>
         </Layout>
       </Layout>
       </Layout>
     </div>
     </HashRouter>
    )
  }
}

export default Home;